package org.deng.learn.designpattern.adapter;

/**
 * @author DengLibin
 * @Description 媒体播放适配器
 * @Date 2019/2/13 0013 9:42
 */
public class MediaAdapter implements MediaPlayer {
    private AdvanceMediaPlayer advanceMediaPlayer;

    public MediaAdapter(String fileType){
        if(fileType.equalsIgnoreCase("vlc")){
            advanceMediaPlayer = new VlcPlayer();
        }else  if(fileType.equalsIgnoreCase("mp4")){
            advanceMediaPlayer = new Mp4Player();
        }
    }
    @Override
    public void play(String fileType, String fileName) {
        if(fileType.equalsIgnoreCase("vlc")){
            advanceMediaPlayer.playVlc(fileName);
        }else  if(fileType.equalsIgnoreCase("mp4")){
            advanceMediaPlayer.playMp4(fileName);
        }
    }
}
